package com.sourcetrip.my;


import com.sourcetrip.my.inter.Deque;

/**
 * @author: ZhouBert
 * @date: 2020/12/14
 * @description:
 */
public class LinkedListDequeV0<E> extends LinkedListQueueV0<E> implements Deque<E> {

	@Override
	public void enQueueRear(E element) {
		this.enQueue(element);
	}

	@Override
	public E deQueueRear() {
		E item = list.remove(size() - 1);
		return item;
	}

	@Override
	public void enQueueFront(E element) {
		list.add(0,element);
	}

	@Override
	public E deQueueFront() {
		E e = this.deQueue();
		return e;
	}

	@Override
	public E front() {
		E e = this.peek();
		return e;
	}

	@Override
	public E rear() {
		E e = list.get(size() - 1);
		return e;
	}
}
